//
//  HTPremiumFollowSection.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/8.
//

import SwiftUI

struct HTPremiumFollowSection: View {

  @EnvironmentObject private var var_store: HTAppStore

  var body: some View {
    HStack{
      VStack(alignment: .leading){
        Text("Follow This Link")
          .font(.system(size: 14))
          .fontWeight(.bold)
          .ht_normal()
        Spacer().frame(height: 3)
        Text("Join premium members group")
          .font(.system(size: 12))
          .ht_normal()
      }
      Spacer()
      HStack(spacing: 20){
        if var_store.state.var_adState.var_adConfig?.ht_phoneVipLink() != "" {
          Button {
            UIApplication.shared.open(URL(string: (var_store.state.var_adState.var_adConfig?.ht_phoneVipLink()) ?? "")!, options: [:], completionHandler: nil)
          } label: {
            Image("subscribe_phone")
          }
        }
        if var_store.state.var_adState.var_adConfig?.ht_telVipLink() != "" {
          Button {
            UIApplication.shared.open(URL(string: var_store.state.var_adState.var_adConfig?.ht_telVipLink() ?? "")!, options: [:], completionHandler: nil)
          } label: {
            Image("subscribe_telegram")
          }
        }
      }
    }
    .padding(12)
    .frame(maxWidth: .infinity)
    .background(Color.white)
    .cornerRadius(6)
  }
}
